package cc.mcyx.ychat.service.impl

import org.springframework.beans.factory.annotation.Autowired
import org.springframework.data.redis.core.RedisTemplate
import org.springframework.stereotype.Service

@Service
class RedisService {
    @Autowired
    lateinit var redisTemplate: RedisTemplate<String, Any>

    fun setData(key: String, value: Any) {
        redisTemplate.opsForValue().set(key, value)
    }

    fun getData(key: String): Any? {
        return redisTemplate.opsForValue().get(key)
    }

    fun delData(key: String) {
        redisTemplate.delete(key)
    }

}